[IA64] display vmx fault messges
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Mon, 19 Jun 2006 19:42:34 +0000 (13:42 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Mon, 19 Jun 2006 19:42:34 +0000 (13:42 -0600)
This patch modifies the vmx fault handler to display a message when a
fault occurs in hypervisor.

This includes the followings:

- Break 0 handler is modified to check psr.vm bit instead of cpl.
- External interrupt handler is modified to get current using
MINSTATE_GET_CURRENT instead of r21.  r21 has been used in DO_SAVE_MIN
which is called from other fault handlers.  I'm not sure why the
original vmx fault handler gets the current from r21.

Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@jp.fujitsu.com>
xen/arch/ia64/vmx/vmx_ivt.S
xen/arch/ia64/vmx/vmx_process.c
xen/arch/ia64/xen/ivt.S
xen/arch/ia64/xen/xenmisc.c
xen/include/asm-ia64/vmx.h

index c7742476573a5e0d9078242d2e067140c18b56ee..fc5d31cd52f2ee0f7b90fb3baae974c2e1cd05aa 100644 (file)
 
 #include "vmx_minstate.h"
 
+#define MINSTATE_VIRT  /* needed by minstate.h */
+#include "minstate.h"
 
 
 #define VMX_FAULT(n)    \
 vmx_fault_##n:;          \
-    br.sptk vmx_fault_##n;         \
+    br.sptk.many dispatch_to_fault_handler;         \
     ;;                  \
 
 
@@ -508,7 +510,7 @@ ENTRY(vmx_interrupt)
     ;;
 .mem.offset 0,0; st8.spill [r16]=r13,16
 .mem.offset 8,0; st8.spill [r17]=r8,16 /* save ar.fpsr */
-    mov r13=r21    /* establish `current' */
+    MINSTATE_GET_CURRENT(r13)
     ;;
 .mem.offset 0,0; st8.spill [r16]=r15,16
 .mem.offset 8,0; st8.spill [r17]=r14,16
index c4391a800592318476fe73061af663f5b2fa6ecc..03865107e96645002f92a14a30447bf4c58a4849 100644 (file)
@@ -125,7 +125,7 @@ vmx_ia64_handle_break (unsigned long ifa, struct pt_regs *regs, unsigned long is
 #endif
     {
         if (iim == 0) 
-            die_if_kernel("bug check", regs, iim);
+            vmx_die_if_kernel("Break 0 in Hypervisor.", regs, iim);
 
         if (!user_mode(regs)) {
             /* Allow hypercalls only when cpl = 0.  */
index 8fe29def28259b0bbf791df42d36e7ae41c7c5be..338abdf8345b64af3976784ac3602d9ec94ba917 100644 (file)
@@ -1493,7 +1493,7 @@ END(dispatch_unaligned_handler)
         * suitable spot...
         */
 
-ENTRY(dispatch_to_fault_handler)
+GLOBAL_ENTRY(dispatch_to_fault_handler)
        /*
         * Input:
         *      psr.ic: off
index ea10d97c6f477b1ddc2f97f7e20757a949bd727a..d1991af9107c2ae8283e5ad4aac4a1cf0c6ed3d8 100644 (file)
@@ -19,6 +19,7 @@
 #include <public/sched.h>
 #include <asm/vhpt.h>
 #include <asm/debugger.h>
+#include <asm/vmx.h>
 #include <asm/vmx_vcpu.h>
 #include <asm/vcpu.h>
 
@@ -109,6 +110,17 @@ void die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ (
        domain_crash_synchronous();
 }
 
+void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err) /* __attribute__ ((noreturn)) */
+{
+       if (vmx_user_mode(regs))
+               return;
+
+       printk("%s: %s %ld\n", __func__, str, err);
+       debugtrace_dump();
+       show_registers(regs);
+       domain_crash_synchronous();
+}
+
 long
 ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
           unsigned long user_rbs_end, unsigned long addr, long *val)
index e25e471225a3c279f3c9e4befdf81c2cbd178373..99ffb7b7ab0a895f886b79a42309cd0588c47a35 100644 (file)
@@ -24,6 +24,7 @@
 
 #define RR7_SWITCH_SHIFT       12      /* 4k enough */
 #include <public/hvm/ioreq.h>
+#define vmx_user_mode(regs) (((struct ia64_psr *)&(regs)->cr_ipsr)->vm == 1)
 
 #define VCPU_LID(v) (((u64)(v)->vcpu_id)<<24)